#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
const int N = 22;
ull a[N][N];
int vis[1 << N];
int main() {
  int h, w;
  scanf("%d%d", &h, &w);
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      scanf("%llu", &a[i][j]);
    }
  }

  queue<unsigned> q;
  q.push(0);
  vis[0] = true;
  unsigned domino_h = 3, domino_v = (1u << w) + 1;
  while (!q.empty()) {
    unsigned s = q.front();
    q.pop();
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w - 1; j++) {
        if (s & (domino_h << (i * w + j)))
          continue;
        unsigned t = s | (domino_h << (i * w + j));
        if (!vis[t]) {
          vis[t] = true;
          q.push(t);
        }
      }
    }
    for (int i = 0; i < h - 1; i++) {
      for (int j = 0; j < w; j++) {
        if (s & (domino_v << (i * w + j)))
          continue;
        unsigned t = s | (domino_v << (i * w + j));
        if (!vis[t]) {
          vis[t] = true;
          q.push(t);
        }
      }
    }
  }
  ull ans = 0;

  for (int s = 0; s < (1 << (h * w)); s++) {
    if (vis[s]) {
      ull res = 0;
      for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {

          if (!(s & (1 << (i * w + j)))) {
            res ^= a[i][j];
          }
        }
      }
      ans = max(ans, res);
    }
  }
  printf("%llu\n", ans);
  return 0;
}